<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/3/10
 * Time: 14:26
 */

namespace App\Http\Controllers\MiniProgram;


use App\Http\Logics\MiniProgram\PartyContentLogic;
use App\Http\Traits\PartyContentTrait;
use App\Http\Controllers\BaseController;
class PartyContentController extends BaseController
{
    use PartyContentTrait;
    /**
     * @SWG\POST(
     *     path="/partyContent/update",
     *     tags={"PartyContent"},
     *     description="更新活动内容",
     *     operationId="updatePartyContent",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="party_id",
     *         in="query",
     *         description="活动ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="content_str",
     *         in="query",
     *         description="内容JSON字符串",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function updatePartyContent()
    {
        $party_id = $this->id;
        $content_str = $this->content_str;
        $data = [
            'party_id' => $party_id,
            'content_str' => $content_str
        ];
        $response = PartyContentLogic::updatePartyContent($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\GET(
     *     path="/partyContent/detail",
     *     tags={"PartyContent"},
     *     description="活动内容详情",
     *     operationId="getPartyContentDetail",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="party_id",
     *         in="query",
     *         description="活动ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getPartyContentDetail()
    {
        $party_id = $this->party_id;
        $data = [
            'party_id' => $party_id
        ];
        $response = PartyContentLogic::getPartyContentDetail($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}